package com.ruoyi.schedule.service.impl;

import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.schedule.domain.Shift;
import com.ruoyi.schedule.mapper.ShiftMapper;
import com.ruoyi.schedule.service.IShiftService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 班次 业务层处理
 */
@Service
public class ShiftServiceImpl implements IShiftService {
    @Autowired
    private ShiftMapper shiftMapper;

    /**
     * 查询班次列表
     */
    @Override
    public List<Shift> selectShiftList(Shift shift) {
        return shiftMapper.selectShiftList(shift);
    }

    /**
     * 新增班次
     */
    @Override
    public int insertShift(Shift shift) {
        shift.setCreateBy(SecurityUtils.getUsername());
        return shiftMapper.insertShift(shift);
    }

    /**
     * 修改班次
     */
    @Override
    public int updateShift(Shift shift) {
        shift.setUpdateBy(SecurityUtils.getUsername());
        return shiftMapper.updateShift(shift);
    }

    /**
     * 批量删除班次
     */
    @Override
    public int deleteShiftByIds(Long[] shiftIds) {
        return shiftMapper.deleteShiftByIds(shiftIds);
    }
}